home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / dsp / dr.bub / 96000.lha / 96000 / appb / b115a.asm < prev    next >
Assembly Source File  |  1992-04-28  |  3KB  |  96 lines

  1. ; This program was originally published in the Motorola DSP96002 Users Manual
  2. ; and is provided under a DISCLAIMER OF WARRANTY available from Motorola DSP
  3. ; Operation, 6501 William Cannon Drive West, Austin, Texas 78735-8598.  For
  4. ; more information, refer to the DSP96002 Users Manual, Appendix B, DSP
  5. ; Benchmarks.
  6. ;
  7. ; B.1.15    Fast Fourier Transforms  
  8. ; B.1.15.1    Radix 2 Decimation in Time FFT  
  9. ;metr2a      macro      points,data,coef,coefsize 
  10. ;metr2a      ident      1,4 
  11. ;Radix 2 Decimation in Time In-Place Fast Fourier Transform Routine 
  12. ;    Complex input and output data 
  13. ;        Real data in X memory 
  14. ;        Imaginary data in Y memory 
  15. ;    Normally ordered input data 
  16. ;    Bit reversed output data 
  17. ;    Coefficient lookup table 
  18. ;        +Cosine value (1/2 cycle) in X memory 
  19. ;        +Sine value (1/2 cycle) in Y memory 
  20. ;    Table size can be i*points/2, i=1,2,... 
  21. ; Macro Call - metr2a   points,data,coef,coefsize 
  22. ;      points     number of points (2 - 2,147,483,648, power of 2) 
  23. ;      data       start of data buffer 
  24. ;      coef       start of 1/2 cycle sine/cosine table 
  25. ;      coefsize   number of table points in sine/cosine table 
  26. ;                  = i*points/2, i=1,2,...    (1 - 2,147,483,648) 
  27. ;         
  28. ; ar         Radix 2         ar' 
  29. ; ai        Butterfly        ai' 
  30. ; br        A'=A+B*Wk        br' 
  31. ; bi        B'=A-B*Wk        bi' 
  32. ;       
  33. ;             
  34. ;                    
  35. ;              wr  wi 
  36. ; wrk = cosine(k*pi/points) table 
  37. ; wik = sine(k*pi/points)   table 
  38. ; ar' = ar + (wr*br + wi*bi) 
  39. ; ai' = ai + (wr*bi - wi*br) 
  40. ; br' = ar -  wr*br - wi*bi = ar - (wr*br + wi*bi) 
  41. ; bi' = ai -  wr*bi + wi*br = ai - (wr*bi - wi*br) 
  42.  
  43.       move    #points,d1.l 
  44.       move    #@cvi(@log(points)/@log(2)+0.5),n1 
  45.       move    #data,r2 
  46.       move    #coef,m2 
  47.       move    #coefsize,d2.l 
  48.  
  49.       move    #0,m6 
  50.       move    #-1,m0 
  51.       clr     d0         m0,m1 
  52.       inc     d0         m0,m4 
  53.       lsr     d2         m0,m5 
  54.       move    d2.l,n6 
  55.  
  56.       do      n1,_end_pass 
  57.       move    r2,r0 
  58.       move    d0.l,n2 
  59.       lsr     d1      m2,r6 
  60.       dec     d1      d1.l,n0 
  61.       move    d1.l,n1 
  62.       move    n0,n4 
  63.       move    n0,n5 
  64.       lea     (r0)+n0,r1 
  65.       lea     (r0)-,r4 
  66.       lea     (r1)-,r5 
  67.  
  68.       do      n2,_end_grp 
  69.       move                              x:(r6)+n6,d9.s y:,d8.s 
  70.       move                              x:(r1)+,d6.s   y:,d7.s 
  71.       fmpy.s  d8,d7,d3                                 y:(r5),d2.s 
  72.       fmpy.s  d9,d6,d0                                 y:(r4),d5.s 
  73.       fmpy.s  d9,d7,d1                                 y:(r1),d7.s 
  74.  
  75.       do      n0,_end_bfy 
  76.       fmpy    d8,d6,d2 fadd.s    d3,d0  x:(r0),d4.s    d2.s,y:(r5)+ 
  77.       fmpy    d8,d7,d3 faddsub.s d4,d0  x:(r1)+,d6.s   d5.s,y:(r4)+ 
  78.       fmpy    d9,d6,d0 fsub.s    d1,d2  d0.s,x:(r4)    y:(r0)+,d5.s 
  79.       fmpy    d9,d7,d1 faddsub.s d5,d2  d4.s,x:(r5)    y:(r1),d7.s 
  80. _end_bfy 
  81.       move                              x:(r0)+n0,d7.s d2.s,y:(r5)+n5 
  82.       move                              x:(r1)+n1,d7.s d5.s,y:(r4)+n4 
  83. _end_grp 
  84.       move    n2,d0.l 
  85.       lsl     d0                        n0,d1.l 
  86. _end_pass 
  87.